/**
 * Created with IDEA
 * author:ju bai
 * Date:2021/5/19
 * Time:10:55
 **/
public class Main1 {
    /**
     * 每日一题-不用加减乘除做加法
     *
     * @param num1 数字1
     * @param num2 数字2
     * @return 相加结果
     */
    public int Add(int num1, int num2) {
        int sum = 0;
        int carry = 0;
        while (num2 != 0) {
            sum = num1 ^ num2;//异或
            carry = (num1 & num2) << 1;//与后再左移一位，为进位
            num1 = sum;
            num2 = carry;
        }
        return num1;
    }
}
